package cn.gson.springboot.model.pojos;

import javax.persistence.*;
import java.math.BigDecimal;
import java.util.Objects;

@Entity
@Table(name = "product_detail", schema = "crm")
public class ProductDetail {
    private int productDetailId;
    private String productDetailRemarks;
    private String productDetailName;
    private String productDetailModel;
    private Integer productDetailCount;
    private BigDecimal productDetailPrice;
    private BigDecimal productDetailMoney;
    private BigDecimal productDetailTotalMoney;
    private Integer productDetailIntoNum;
    private Integer productDetailOutNum;
    private Maintenance maintenanceByMaiId;
    private Purchase purchaseByPurchaseId;
    private Product productByProductId;
    private Quotation quotationByQuotationId;
    private Contract contractByContractId;

    @Id
    @Column(name = "product_detail_id", nullable = false)
    @GeneratedValue(strategy = GenerationType.IDENTITY,generator = "seq")
    public int getProductDetailId() {
        return productDetailId;
    }

    public void setProductDetailId(int productDetailId) {
        this.productDetailId = productDetailId;
    }




    @Basic
    @Column(name = "product_detail_remarks", nullable = true, length = 255)
    public String getProductDetailRemarks() {
        return productDetailRemarks;
    }

    public void setProductDetailRemarks(String productDetailRemarks) {
        this.productDetailRemarks = productDetailRemarks;
    }

    @Basic
    @Column(name = "product_detail_name", nullable = true, length = 255)
    public String getProductDetailName() {
        return productDetailName;
    }

    public void setProductDetailName(String productDetailName) {
        this.productDetailName = productDetailName;
    }

    @Basic
    @Column(name = "product_detail_model", nullable = true, length = 255)
    public String getProductDetailModel() {
        return productDetailModel;
    }

    public void setProductDetailModel(String productDetailModel) {
        this.productDetailModel = productDetailModel;
    }

    @Basic
    @Column(name = "product_detail_count", nullable = true)
    public Integer getProductDetailCount() {
        return productDetailCount;
    }

    public void setProductDetailCount(Integer productDetailCount) {
        this.productDetailCount = productDetailCount;
    }

    @Basic
    @Column(name = "product_detail_price", nullable = true, precision = 2)
    public BigDecimal getProductDetailPrice() {
        return productDetailPrice;
    }

    public void setProductDetailPrice(BigDecimal productDetailPrice) {
        this.productDetailPrice = productDetailPrice;
    }

    @Basic
    @Column(name = "product_detail_money", nullable = true, precision = 2)
    public BigDecimal getProductDetailMoney() {
        return productDetailMoney;
    }

    public void setProductDetailMoney(BigDecimal productDetailMoney) {
        this.productDetailMoney = productDetailMoney;
    }

    @Basic
    @Column(name = "product_detail_total_money", nullable = true, precision = 2)
    public BigDecimal getProductDetailTotalMoney() {
        return productDetailTotalMoney;
    }

    public void setProductDetailTotalMoney(BigDecimal productDetailTotalMoney) {
        this.productDetailTotalMoney = productDetailTotalMoney;
    }

    @Basic
    @Column(name = "product_detail_into_num", nullable = true, precision = 2)
    public Integer getProductDetailIntoNum() {
        return productDetailIntoNum;
    }

    public void setProductDetailIntoNum(Integer productDetailIntoNum) {
        this.productDetailIntoNum = productDetailIntoNum;
    }

    @Basic
    @Column(name = "product_detail_out_num", nullable = true, precision = 2)
    public Integer getProductDetailOutNum() {
        return productDetailOutNum;
    }

    public void setProductDetailOutNum(Integer productDetailOutNum) {
        this.productDetailOutNum = productDetailOutNum;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        ProductDetail that = (ProductDetail) o;
        return productDetailId == that.productDetailId &&
                Objects.equals(productDetailRemarks, that.productDetailRemarks) &&
                Objects.equals(productDetailName, that.productDetailName) &&
                Objects.equals(productDetailModel, that.productDetailModel) &&
                Objects.equals(productDetailCount, that.productDetailCount) &&
                Objects.equals(productDetailPrice, that.productDetailPrice) &&
                Objects.equals(productDetailMoney, that.productDetailMoney) &&
                Objects.equals(productDetailTotalMoney, that.productDetailTotalMoney);
    }

    @Override
    public int hashCode() {
        return Objects.hash(productDetailId, productDetailRemarks, productDetailName, productDetailModel, productDetailCount, productDetailPrice, productDetailMoney, productDetailTotalMoney);
    }

    @ManyToOne
    @JoinColumn(name = "mai_id", referencedColumnName = "mai_id")
    public Maintenance getMaintenanceByMaiId() {
        return maintenanceByMaiId;
    }

    public void setMaintenanceByMaiId(Maintenance maintenanceByMaiId) {
        this.maintenanceByMaiId = maintenanceByMaiId;
    }

    @ManyToOne
    @JoinColumn(name = "purchase_id", referencedColumnName = "purchase_id")
    public Purchase getPurchaseByPurchaseId() {
        return purchaseByPurchaseId;
    }

    public void setPurchaseByPurchaseId(Purchase purchaseByPurchaseId) {
        this.purchaseByPurchaseId = purchaseByPurchaseId;
    }

    @ManyToOne
    @JoinColumn(name = "product_id", referencedColumnName = "product_id")
    public Product getProductByProductId() {
        return productByProductId;
    }

    public void setProductByProductId(Product productByProductId) {
        this.productByProductId = productByProductId;
    }

    @ManyToOne
    @JoinColumn(name = "quotation_id", referencedColumnName = "quotation_id")
    public Quotation getQuotationByQuotationId() {
        return quotationByQuotationId;
    }

    public void setQuotationByQuotationId(Quotation quotationByQuotationId) {
        this.quotationByQuotationId = quotationByQuotationId;
    }

    @ManyToOne
    @JoinColumn(name = "contract_id", referencedColumnName = "contract_id")
    public Contract getContractByContractId() {
        return contractByContractId;
    }

    public void setContractByContractId(Contract contractByContractId) {
        this.contractByContractId = contractByContractId;
    }
}
